<?php
//接收删除的id
$id=$_GET['id'];
$dbh = new PDO('mysql:host=localhost;dbname=three', "root", "root");
//开启事务
$dbh->beginTransaction();
$sql="delete from user where user_id=$id";
/*  更改数据库架构及数据 */
$res = $dbh->exec($sql);
if($res){
    //提交事务
    $dbh->commit();
    echo "<script>alert('删除成功');location.href='show.php'</script>";
}else{
    /*  识别出错误并回滚更改 */
    $dbh->rollBack();
}

